package ru.dadle8;

import java.util.HashMap;
import java.util.Properties;

public abstract class AbstractConsumer {

    public abstract void readMessages(String topicName);

    protected Properties getKafkaProperties() {
        // create instance for properties to access producer configs
        java.util.Properties props = new Properties();
        props.putAll(new HashMap<>() {{
            //Assign localhost id
            put("bootstrap.servers", "localhost:29092");

            put("group.id", "test");
            put("enable.auto.commit", "true");
            put("auto.commit.interval.ms", "1000");
            put("session.timeout.ms", "30000");

            put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
            put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
        }});

        return props;
    }
}
